{{extend 'layout.html'}}

<div>

    <p>Local Exploit Database directory is <code>{{=settings.exploitdb_path}}</code>.</p>

    <div id="exploitdbform" class="btn-toolbar">
        <a href="{{=URL('exploitdb', 'update_db')}}" id="update_db" class="btn btn-small">
            <i class="icon-refresh"></i> Update Database</a>
        <a href="{{=URL('exploitdb', 'git_pull')}}" id="git_pull" class="btn btn-small">
            <i class="icon-download-alt"></i> Pull from github</a>
        <a id="about" href="#about-modal" role="button" data-toggle="modal" class="btn btn-small">
            <i class="icon-question-sign"></i> Help</a>
    </div>

    <table cellpadding="0" cellspacing="0" border="0" class="datatable" id="exploitdb_table" width="100%">
        <thead>
            <tr>
                <th>ID</th>
                <th>Description</th>
                <th>Date</th>
                <th>Author</th>
                <th>Platform</th>
                <th>Type</th>
                <th>Port</th>
            </tr>
        </thead>
    </table>
</div>

<div id="help-modal" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>The Exploit Database</h3>
  </div>
  <div class="modal-body">
      <p>A local copy of the <a href="http://www.exploit-db.com" target="_href">Exploit Database</a> can be cloned from
         the <a href="https://github.com/offensive-security/exploit-database" target="_blank">Offensive Security Github
         repository</a> and stored locally for access from within Kvasir.</p>
      <ol>
          <li>Open a terminal window and change to a directory of your choosing</li>
          <li>Execute <code>git clone https://github.com/offensive-security/exploit-database.git</code>. This will
              create a local directory with the latest data from the repository.</li>
          <li>In your <code>kvasir.yaml</code> file set the <code>exploitdb_path</code> value to the directory path.
              Example: <code>exploitdb_path: "/usr/share/exploitdb"</code></li>
      </ol>
      <p>To syncronize the local files and Kvasir, press the <code>Update Database</code> button. If git was used the
         <code>Pull from Git</code> button will attempt to synchronize the filesystem and Kvasir database with the
         latest version.</p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn" data-dismiss="modal">Close</a>
  </div>
</div>

<script type="text/javascript" language="javascript">

var exploitdb_table;

jQuery(document).ready(function() {

    hosttable = $('#exploitdb_table').dataTable( {
        "bServerSide": true,
        "sAjaxSource": "list.json",
        "sDom": 'TC<"clear">lfrtip',
        "oTableTools": {
            "sSwfPath": "{{=URL(request.application, 'static', 'TableTools/swf/copy_csv_xls.swf')}}",
        },
        "aaSorting": [[ 2, "desc" ]],
        "aoColumnDefs": [
            { "sSortDataType": "formatted-num", "aTargets": [ 0 ] },
        ],
    } );

    $.extend( $.fn.dataTableExt.oStdClasses, {
        "sWrapper": "dataTables_wrapper form-inline",
    } );

} );

</script>
